import dataloader
import world
import numpy
data = dataloader.Loader(config = world.config,path="../data/gowalla")
#训练集中所有用户交互数据 [users][所有商品交互信息]
train_pos = data.allPos
#测试集中所有用户交互数据 {users:[items]}
test_pos = data.testDict
is_chongfu = False
for i in test_pos.keys():
    train_item_pos = train_pos[i]
    test_item_pos = test_pos[i]
    #获取测试集和训练集用户数据中较短的
    if len(train_item_pos)>len(test_item_pos):
        length = len(test_item_pos)
        short_items = test_item_pos
        long_items = train_item_pos
    else:
        length = len(train_item_pos)
        items = train_item_pos
        long_items = test_item_pos
    flag = 0
    for j in range(length):
        if short_items[j] in long_items:
            flag = 1;
            is_chongfu = True
            break;
    if flag==1:
        break;
    else:
        print("用户",i,"测试集的交互商品数据和训练集的交互商品数据没有重复")
if is_chongfu:
    print("测试集的交互商品数据和训练集的交互商品数据重复了")
else:
    print("所有用户都没有重复")